package com.itheima.stream;

import java.util.*;
import java.util.stream.Stream;

/*
获取流的操作
 */
public class Demo01 {


    public static void main(String[] args) {
        //单列集合  Collection  stream()
      ArrayList<String> list = new ArrayList<>(List.of("蔡徐坤", "鹿晗", "吴签", "黄子韬"));
        Stream<String> stream = list.stream();
        stream.forEach(s-> System.out.println(s));
        /*   list.stream().forEach(s-> System.out.println(s));*/


        //双列集合 Map 没有直接获取流的方式  间接  keySet   entrySet    Collection  stream()
        HashMap map = new HashMap(Map.of("马蓉", "宋喆", "小璐", "PGOne", "熊黛林", "宝强"));
        map.keySet().stream().forEach(s-> System.out.println(s));
        map.entrySet().stream().forEach(s-> System.out.println(s));

        //数组 Arrays.stream(数组)
        int[] arr={11,22,33,44,55};
        Arrays.stream(arr).forEach(s-> System.out.println(s));

        //多个相同类型的数据 Stream.of()
        Stream.of("谢广坤","刘能","王大拿","赵四").forEach(s-> System.out.println(s));


    }
}
